<?php
declare(strict_types=1);
namespace Field;

class AuthBlacknameConst
{
    public const pk='';
    public const index=['NickID','ItemNumID'];
	public const fields=['NickID','ItemNumID','UserID','CreateAt','UserLock','SysLock'];
	public const comment=['NickID'=>'店铺授权ID','ItemNumID'=>'宝贝ID','UserID'=>'录入用户','CreateAt'=>'创建时间','UserLock'=>'用户锁','SysLock'=>'系统锁定1,2,3,4'];
	/*
    * @Field NickID
    * @Type int(10) unsigned
    * @Collation 
    * @Null NO
    * @Key PRI
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 店铺授权ID
    */
    public const NickID = 'NickID';
    /*
    * @Field ItemNumID
    * @Type bigint(20)
    * @Collation 
    * @Null NO
    * @Key PRI
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 宝贝ID
    */
    public const ItemNumID = 'ItemNumID';
    /*
    * @Field UserID
    * @Type int(10) unsigned
    * @Collation 
    * @Null NO
    * @Key MUL
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 录入用户
    */
    public const UserID = 'UserID';
    /*
    * @Field CreateAt
    * @Type timestamp
    * @Collation 
    * @Null YES
    * @Key 
    * @Default CURRENT_TIMESTAMP
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 创建时间
    */
    public const CreateAt = 'CreateAt';
    /*
    * @Field UserLock
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 用户锁
    */
    public const UserLock = 'UserLock';
    /*
    * @Field SysLock
    * @Type char(32)
    * @Collation utf8mb4_general_ci
    * @Null YES
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 系统锁定1,2,3,4
    */
    public const SysLock = 'SysLock';
}

class AuthBlacknameColumns
{
public  int $NickID;
   public  int $ItemNumID;
   public  int $UserID;
   public  ?string $CreateAt='';
   public  int $UserLock=0;
   public  ?string $SysLock='';
	public function toArray():array
	{
		return [
'NickID'=>$this->NickID,
    'ItemNumID'=>$this->ItemNumID,
    'UserID'=>$this->UserID,
    'CreateAt'=>$this->CreateAt,
    'UserLock'=>$this->UserLock,
    'SysLock'=>$this->SysLock,        ];
	}
}

class AuthBlacknameRow
{
	public AuthBlacknameColumns $data;
	public function toArray():array
	{
		return $this->data->toArray();
    }

    public function getValue(string $field):string|int|null
    {
        return match ($field){
        'NickID' => $this->data->NickID,
        'ItemNumID' => $this->data->ItemNumID,
        'UserID' => $this->data->UserID,
        'CreateAt' => $this->data->CreateAt,
        'UserLock' => $this->data->UserLock,
        'SysLock' => $this->data->SysLock, default=>null
        };
    }

    public function __construct(array $data)
    {
        $this->data = new AuthBlacknameColumns();
        isset($data['NickID']) && $this->data->NickID = (int)$data['NickID'];
           isset($data['ItemNumID']) && $this->data->ItemNumID = (int)$data['ItemNumID'];
           isset($data['UserID']) && $this->data->UserID = (int)$data['UserID'];
           isset($data['CreateAt']) && $this->data->CreateAt = (string)$data['CreateAt'];
           isset($data['UserLock']) && $this->data->UserLock = (int)$data['UserLock'];
           isset($data['SysLock']) && $this->data->SysLock = (string)$data['SysLock'];
    }
}
?>